<%-- 
    Document   : detail
    Created on : Nov 23, 2014, 10:37:17 PM
    Author     : Marian Lorenc, 374122
--%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title><fmt:message key="revision.revisionofmachine"/></title>
    </head>
    <body>
        <div class="container">
            <c:if test="${null == model}">
                <img src="<c:url value="/resources/pictures/error.png" />" title="<fmt:message key="revision.notfound" />" />
                <b><fmt:message key="revision.notfound" /></b>
            </c:if>
            <c:if test="${null != model}">
                <c:if test="${null == model.revision}">
                    <img src="<c:url value="/resources/pictures/error.png" />" title="<fmt:message key="revision.notfound" />" />
                    <b><fmt:message key="revision.notfound" /></b>
                </c:if>

                <c:if test="${null != model.revision}">
                    <h1><fmt:message key="revision.revisionofmachine" /> <c:out value="${model.revision.machine.code}"/> (<c:out value="${model.revision.machine.brand}"/> <c:out value="${model.revision.machine.model})"/></h1>
                    <sec:authorize access="hasRole('ROLE_ADMIN')">
                        <div>
                            <a href="<c:url value="/revision/remove/${model.revision.id}"/>" onclick="return confirm('<fmt:message key="remove.confirm" />')">
                                <img src="<c:url value="/resources/pictures/remove.png" />" title="<fmt:message key="remove" />" /> <fmt:message key="remove" />
                            </a>
                        </div>
                    </sec:authorize>
                    <table class="table table-striped">
                        <tr>
                            <td><b><fmt:message key="revision.dateofrevision" /></b></td>
                            <td><c:out value="${model.revision.dateOfRevision}"/></td>
                        </tr>
                        <tr>
                            <td><b><fmt:message key="revision.description" /></b></td>
                            <td><c:out value="${model.revision.description}"/></td>
                        </tr>

                    </table>
                </c:if>
            </c:if>
        </div>
        <button onclick="goBack()" class="btn btn-default"><fmt:message key="back" /></button>
    </body>
</html>
